package org.jeecg.modules.quartz.job;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.quartz.service.IMeterReadService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StopWatch;


/**
 * 定时读表
 */
@Slf4j
public class ReadMeterTask implements Job {
    @Autowired
    private IMeterReadService meterReadService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start("开始执行定时读表");
        meterReadService.readMeterTask();
        stopWatch.stop();
        log.info("读表耗时:{}",stopWatch.prettyPrint());
    }
}
